<template>
	<view class="f24r col333">
		<navbar background="background-image: linear-gradient(to right, #2c6739, #99c043);"
			title="消息列表" back @onBack="goBack" @topTotalHeight="topTotalHeight"
		></navbar>
		<scroll-view :style="'height: ' + 'calc(100vh - ' + calcNum + 'px);'"
			class="overYS poRel" scroll-y="true" @scrolltolower="orderScroll"
			:refresher-enabled="true" @refresherrefresh="orderRefresh" :refresher-triggered="ordertri0"
		>
			<informationList :infoDataList="detailedList0" :infoMore="noMore0"
			></informationList>
		</scroll-view>
		<!-- <view class="pl20r pr20r pb20r">
			<view class="" v-for="(item, index) in noticeList" :key="index"
				@click="cliNoticeBtn"
			>
				<view class="teAliCenter col888888 mt40r mb20r">
					2023-02-05 23:41
				</view>
				<view class="borRad20r backColWhite poRel">
					<image src="/static/images/logo.png" mode="aspectFill"
						class="wPer100 h300r borRad20r"
					></image>
					<view class="pl20r pr20r pt15r pb20r">
						<view class="webLiCl1 webBoxOrVer overHid disWebBox foWeiBold f28r">
							元宵节快乐！
						</view>
						<view class="col4b4b4b webLiCl1 webBoxOrVer overHid disWebBox mt10r">
							<text class="colC8c9cb">
								【未读】
							</text>
							<text class="col59bb73">
								【已读】
							</text>
							元宵节快乐！
						</view>
					</view>
					<image :src="baseUrl + 'iconThreePoints.png'" mode="aspectFit"
						class="poAbs top10r rig10r w40r h40r" @click.stop="cliThreePoints"
					></image>
				</view>
			</view>
		</view> -->
	</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import { baseUrl } from '@/utils/request.js'
import { getMemberMsgList } from '@/utils/api.js'
import informationList from '@/components/informationList.vue'
export default {
	components: { navbar, informationList },
	data() {
		return {
			baseUrl,
			token: '',
			calcNum: 0,
			optionType: '',
			ordertri0: false, detailedList0: [], noMore0: false, page0: 0,
		}
	},
	onLoad(options) {
		if(options.type) this.optionType = options.type;
		if(uni.getStorageSync('token')) {
			this.token = uni.getStorageSync('token');
			this.getDataList1(0, options.type);
		}
	},
	methods: {
		goBack() {
			uni.navigateBack()
		},
		topTotalHeight(height) {
			// #ifdef MP-WEIXIN
				this.calcNum = height;
			// #endif
			// #ifdef H5
				this.calcNum = 0;
			// #endif
		},
		getDataList1(page, type, callBack) {
			getMemberMsgList({
				token: this.token, number: 15,
				page, type
			}).then(res => {
				if(page > 0) {
					this.detailedList0 = this.detailedList0.concat(res.data.data);
				}else {
					this.detailedList0 = res.data.data;
				}
				if(res.data.number < 15) this.noMore0 = true;
				uni.hideLoading();
				if(callBack) callBack();
			})
		},
		orderScroll() {
			if(!this.noMore0) {
				this.page0 += 1;
				this.getDataList1(this.page0, this.optionType);
			}
		},
		orderRefresh() {
			if(!this.ordertri0) {
				this.ordertri0 = true;
				this.noMore0 = false;
				this.page0 = 0;
				this.getDataList1(0, this.optionType, () => {
					this.ordertri0 = false;
				})
			}
		},
		// cliNoticeBtn() {
		// 	uni.navigateTo({
		// 		url: '/pages/newsTab/noticeDetail'
		// 	})
		// },
		// cliThreePoints() {
		// 	uni.showActionSheet({
		// 		itemList: ['删除'],
		// 		success:res1 => {
		// 			if(res1.tapIndex == 0) {
		// 				console.log(res1)
		// 			}
		// 		}
		// 	})
		// }
	}
}
</script>
<style>
page {background-color: white;}
</style>